﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;

namespace MC.RideEvent.Mvc.Models.ViewModel
{
    public class EventViewModel
    {
        public int Id { get; set; }

        [Required(ErrorMessage = "*")]
        [Display(Name = "Intitulé" )]
        [StringLength(50)]
        public string Title { get; set; }

        [Required(ErrorMessage = "*")]
        [Display(Name = "Description")]
        public string Description { get; set; }

        [Required(ErrorMessage = "*")]
        [Display(Name = "Lieu")]
        public string NamePlace { get; set; }

        [Display(Name = "Prix")]
        public int? Price { get; set; }

        [Required(ErrorMessage = "*")]
        [Display(Name = "Adresse")]
        public string Address { get; set; }

        [Required(ErrorMessage = "*")]
        [Display(Name = "Ville")]
        public string City { get; set; }

        [Required(ErrorMessage = "*")]
        [Display(Name = "Cp")]
        public string Cp { get; set; }

        [Required(ErrorMessage = "*")]
        [Display(Name = "Date début")]
        public DateTime DateBegin { get; set; }

        [Required(ErrorMessage = "*")]
        [Display(Name = "Date fin")]
        public DateTime DateEnd { get; set; }

        [Display(Name = "Lien")]
        public string SiteLink { get; set; }

        [Display(Name = "Image")]
        public string Img { get; set; }

        public bool Activated { get; set; }

        /// <summary>
        /// Return full address of event.
        /// </summary>
        /// <returns></returns>
        public string FullAddress()
        {
            string fullAddress = string.Format("{0} {1} {2}", Address, Cp, City);

            return fullAddress;
        }

        public string BeginDayOfEvent()
        {
            string day = string.Format("{0}", DateBegin.ToString("dd MMM yyyy"));

            return day;
        }

        public string EndDayOfEvent()
        {
            string day = string.Format("{0}", DateEnd.ToString("dd MMM yyyy"));

            return day;
        }

        #region Dependency properties

        /// <summary>
        /// This field indicates whether the current user
        /// has already created a path on the current event.
        /// </summary>
        [ScaffoldColumn(false)]
        public bool WayUserExist { get; set; }

        #endregion
    }
}